package com.timmy.chi.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import com.timmy.chi.R;
import com.timmy.chi.sql.SqlDao;
import com.timmy.chi.utils.SPUtils;

/**
 * Created by Timmy on 2017/4/29.
 */

public class SplashActivity extends AppCompatActivity {

    private String spName = "splash";

    private static final String TAG = SplashActivity.class.getSimpleName();
    private SqlDao mDao;
    private Handler mHandler = new Handler();
    private Boolean mSplash;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        mDao = SqlDao.getInstance().init(this);
        mSplash = (Boolean) SPUtils.get(this, spName, false);

        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                goLogin();
            }
        }, 1200);
    }

    private void goLogin() {

        Intent intent = new Intent(SplashActivity.this, LogInActivity.class);
        startActivity(intent);
        finish();
    }
}
